import request from '@/router/axios'
import store from '@/store'
import {
  getMappingStatus,
  fenExYuangettoFixed,
  getSysUserToLS,
  getLineName,
  getStationName,
  getAssistCategory,
  assistCategoryDeviceData
} from "../../../../../subwayRat/commonCheck";

export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  selection: true,
  reserveSelection:false,
  stripe: true,
  menuAlign: 'center',
  viewBtn: false,
  editBtn: false,
  emptyBtn:false,
  delBtn: false,
  align: 'center',
  addBtn: false,
  height: 450,
  column: [{
    fixed: true,
    label: '主键',
    prop: 'id',
    span: 24,
    type: 'input',
    hide: true
  }, {
    label: '线路',
    prop: 'lineCode',
    type: 'select',
    hide:true,
    search: false,
    searchslot : true,
    // filterable : true,
    // cascaderItem: ["stationCode"],
    // props: {
    //   label: 'name',
    //   value: 'code'
    // },
    // dicUrl: "/check/check/getLineAll",
    display: true ,// 动态显隐控制不能删除
    formatter:function (row,v) {
      return getLineName(v);
    }
  }, {
    hide: false,
    label: '站点',
    prop: 'stationCode',
    type: 'select',
    search: true,
    searchslot : true,
    // filterable : true,
    // dicFlag: false,
    // cascaderItem: ["tvmOrder"],
    // props: {
    //   label: 'name',
    //   value: 'code'
    // },
    // dicUrl: "/check/check/getStationByCode?line_code={{key}}",
    display: true,// 动态显隐控制不能删除
    formatter:function (row,v) {
      return getStationName(row.lineCode,v);
    }
  }, {
    hide: false,
    label: 'TVM编号',
    prop: 'tvmCode',
    type: 'select',
    search: true,
    searchslot : true,
    // filterable : true,
    // dicFlag: false,
    // props: {
    //   label: 'tvmCode',
    //   value: 'tvmCode'
    // },
    // dicUrl: "/check/check/getSwPmTvmCodeList?stationCode={{key}}"
    display: true// 动态显隐控制不能删除
  },  {
    label: '收入日期',
    prop: 'incomeTime',
    type: 'date',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    search: true,
    hide: false,
    width: 120
  }, {
    label: 'SC售票',
    prop: 'saleAmount',
    formatter:function (row,value , label, column) {
      return fenExYuangettoFixed(row,'saleAmount');
    },
    search: false,
    hide: false,
  },  {
    label: 'SC充值',
    prop: 'depositAmount',
    formatter:function (row,value , label, column) {
      return fenExYuangettoFixed(row,'depositAmount');
    },
    search: false,
    hide: false,
  },  {
    label: 'SC故障退款',
    prop: 'errorRefundAmount',
    formatter:function (row,value , label, column) {
      return fenExYuangettoFixed(row,'errorRefundAmount');
    },
    search: false,
    hide: false,
    width: 90
  },  {
    label: '系统金额',
    prop: 'tvmBillOrderMoney',
    formatter:function (row,value , label, column) {
      return fenExYuangettoFixed(row,'tvmBillOrderMoney');
    },
    search: false,
    hide: false,
    width: 95
  }, {
    label: '实点金额',
    prop: 'actualMoney',
    formatter:function (row,value , label, column) {
      return fenExYuangettoFixed(row,'actualMoney');
    },
    search: false,
    hide: false,
  },{
    //   label: '卸载状态',
    //   prop: 'settleTime',
    //   search: false,
    //   formatter:function (row, value , label, column){
    //     return value == 1?'已反馈':'未反馈';
    //   }
    // }, {
      label: '差异金额',
      prop: 'diffMoney',
      formatter:function (row,value , label, column) {
        return fenExYuangettoFixed(row,'diffMoney');
      },
      search: false,
      hide: false,
    }, {
      hide: false,
      label: '机电协查差异原因',
      type: 'select',
      searchLabelWidth:130,
      prop: 'replyReason',
      formatter:function (row,v) {
        return getMappingStatus('REPLY_REASON',v);
      },
      search: true,
      dicData:[{
        label: '系统原因',
        value: '1'
      }, {
        label: '非系统原因',
        value: '2'
      }],
      width: 120
    }, {
      label: '差异详情',
      prop: 'replyContent',
      hide: true
    }, {
    label: '通知时间',
    prop: 'sendTime',
    type: 'datetime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    search: true,
    hide: false,width: 90
  }, {
    hide: false,
    label: '操作人员',
    prop: 'operatorName',
    search: false
  }, {
    hide: false,
    label: '操作人员工号',
    prop: 'operatorCode',
    search: false,
    width: 95
  }, {
    hide: false,
    label: '协查状态',
    prop: 'replyStatus',
    search: true,
    type: 'select',
    dicData: [{
      label: '未反馈',
      value: '0'
    }, {
      label: '已反馈',
      value: '1'
    }]
    // formatter:function (row, value , label, column){
    //   return value == 1?'已反馈':'未反馈';
    // }
  }, {
      hide: false,
      label: '协查类型',
      type: 'select',
      searchLabelWidth:130,
      prop: 'assistCategory',
      formatter:function (row,v) {
        return getAssistCategory(v);
      },
      search: true,
      dicData:assistCategoryDeviceData(),
      width: 120
    }]
}
export function getSwAuTvmSingleAssistList(query) {
  return request({
    url: '/check/checkNew/getSwAuTvmSingleAssistList',
    method: 'post',
    params: query
  })
}

export function getSwAuTvmSingleAssistLisCenter(param) {
  return request({
    url: '/check/checkNew/getSwAuTvmSingleAssistLisCenter',
    method: 'post',
    data: param
  })
}


export function updateSwAuTvmSingleAssistToStatus(param) {
  return request({
    url: '/check/checkNew/updateSwAuTvmSingleAssistToStatus',
    method: 'post',
    data: param
  })
}
export function updateSwAuTvmSingleAssist(param) {
  return request({
    url: '/check/checkNew/updateSwAuTvmSingleAssist',
    method: 'post',
    data: param
  })
}

/**
 * 导出
 * @param query
 */
 export function exportTvmSingle(query) {
  return request({
    url: '/check/checkNew/exportTvmSingle',
    method: 'get',
    params: query,
    responseType:'blob'
  })
}
/**
 * 导入
 * @param body
 */
export function importTVMSingle(body) {
  return request({
    url: "/check/checkNew/importTvmSingle",
    headers: { "Content-Type": "multipart/form-data" },
    method: "post",
    data: body
  });
}

/**
 * 撤回TVM单台设备票款差异
 * @param query
 */
 export function revokeTvmDanTai(query) {
  return request({
    url: '/check/checkNew/revokeTvmDanTai',
    method: 'post',
    params: query,
    data:query,
  })
}
